package cn.tedu.file.service.impl;

import cn.tedu.file.service.FileService;
import cn.tedu.file.util.FileUploadUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
public class LocalFileServiceImpl implements FileService {
    /**
     * 上传文件存储在本地的根路径
     */
    @Value("${file.path}")
    private String localFilePath;
    @Override
    public String uploadFile(MultipartFile file) throws Exception {
        String url = FileUploadUtils.upload(localFilePath, file);
        return url;
    }
}
